import { useUserStoreHook } from "@/store/modules/user"

/** 全局权限判断函数，和权限指令 v-permission 功能类似 */
export const checkPermission = (permissions: string): boolean => {
  if (permissions) {
    const { permissionList } = useUserStoreHook()
    return permissionList.includes(permissions)
  } else {
    console.error("need roles! Like checkPermission(['admin','editor'])")
    return false
  }
}
